Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing IommiModel #325

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Introducing IommiModel #325

wants to merge 5 commits into from

Conversation

jlubcke
Copy link
Collaborator

@jlubcke jlubcke commented Oct 31, 2022

No description provided.

@boxed
Copy link
Collaborator

boxed commented Oct 31, 2022

@jlubcke thinks there is a better name for get_annotation_attributes, so we'll wait a while to see if one appears.

@boxed
Copy link
Collaborator

boxed commented Oct 31, 2022

We should add this to IommiModel:

    def __repr__(self):
        return f'<{self.__class__.__name__} pk={self.pk}>'

and where did we stand on making IommiModel an empty class and have the essential functionality in a mixin? We talked about it at least...

@boxed
Copy link
Collaborator

boxed commented Nov 1, 2022

Other name suggestions for get_annotation_attributes:

  • get_annotation_attributes
  • get_custom_attributes
  • get_allowed_extra_attributes
  • get_extra_attributes

iommi/model.py Outdated Show resolved Hide resolved
return result

def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
if self.pk is not None and not force_insert:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we only do this if the user has not passed any other update_fields. (Or should we assert there are none? Or verify that the passed is a subset of what we expect?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subset feels more logical. But it's also a bit weird... Maybe warn if update_fields is passed at all? My gut feeling is that you should pick a method, but also that you want it to be possible to slowly migrate to this system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants